package com.bwie.esdemo0122.controller;


import com.bwie.esdemo0122.service.EsIndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @Description: es索引控制器
 * @Version: 1.0
 */
@RestController
@RequestMapping("/index")
public class EsIndexController {

    @Autowired
    private EsIndexService testService;

    /**
     * 创建索引
     */
    @PostMapping("/createIndex")
    public boolean createIndex(@RequestBody Map<String, Object> indexInfo) {
        return testService.createIndex(indexInfo);
    }

    /**
     * 删除索引
     */
    @RequestMapping("/deleteIndex")
    public boolean deleteIndex(@RequestParam(value = "indexName") String indexName) {
        //推送到mq
        return testService.deleteIndex(indexName);
    }
}
